package com.cyy.prototype_pattern;

import com.cyy.prototype_pattern.shadow_clone.Hong;
import com.cyy.prototype_pattern.shadow_clone.Qian;

/**
 * 浅克隆测试
 */
public class ShadowDemo2 {
    public static void main(String[] args) throws CloneNotSupportedException {
        Qian qian = new Qian("两只手","两只脚","两只眼",new Hong("完整的灵魂"));
        Qian qian1 = qian.clone();
        qian1.getHong().setLh("灵魂受到了攻击");
        qian1.setJiao("断了一只脚");
        System.out.printf("虹猫本体的身体状态：%s，%s,%s,%s,",qian.getHong().getLh(),qian.getJiao(),qian.getShou(),qian.getYan());
        System.out.println();
        System.out.printf("虹猫克隆一号的身体状态：%s，%s,%s,%s,",qian1.getHong().getLh(),qian1.getJiao(),qian1.getShou(),qian1.getYan());


    }
}
